<?php
declare (strict_types=1);

namespace app\mall\model\product\admin;

use app\common\model\Attach;
use app\common\model\BaseModel;
use think\model\relation\BelongsTo;

/**
 * 定义商品轮播图模型
 */
class ProductSwiper extends BaseModel
{
    // 表名
    protected $name = 'mall_product_swiper';

    // 设置隐藏字段
    protected $hidden = ['create_time'];

    public function attach(): BelongsTo
    {
        return $this->belongsTo(Attach::class, 'attach_id')->hidden(['id', 'product_id'])->bind(['fileurl']);
    }

}
